﻿/**
 * @name umi 的路由配置
 * @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置
 * @param path  path 只支持两种占位符配置，第一种是动态参数 :id 的形式，第二种是 * 通配符，通配符只能出现路由字符串的最后。
 * @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径，也可以是相对路径，如果是相对路径，会从 src/pages 开始找起。
 * @param routes 配置子路由，通常在需要为多个路径增加 layout 组件时使用。
 * @param redirect 配置路由跳转
 * @param wrappers 配置路由组件的包装组件，通过包装组件可以为当前的路由组件组合进更多的功能。 比如，可以用于路由级别的权限校验
 * @param name 配置路由的标题，默认读取国际化文件 menu.ts 中 menu.xxxx 的值，如配置 name 为 login，则读取 menu.ts 中 menu.login 的取值作为标题
 * @param icon 配置路由的图标，取值参考 https://ant.design/components/icon-cn， 注意去除风格后缀和大小写，如想要配置图标为 <StepBackwardOutlined /> 则取值应为 stepBackward 或 StepBackward，如想要配置图标为 <UserOutlined /> 则取值应为 user 或者 User
 * @doc https://umijs.org/docs/guides/routes
 */

export default [
  {
    path: '/user',
    layout: false,
    routes: [
      //登录页面
      {
        name: 'login',
        path: '/user/login',
        component: './user/login',
      },
      //绑定用户
      {
        name: 'bind',
        path: '/user/bind',
        component: './user/bind',
      },
      //微信扫码跳转
      {
        name: 'wechat',
        path: '/user/wechat',
        component: './user/wechat',
      },
      //切换单位
      {
        name: 'select',
        path: '/user/select',
        component: './user/select',
      },
      //免登录入口
      {
        name: 'nested',
        path: '/user/nested',
        component: './user/nested',
      },
      //传媒大脑 登录入口
      {
        name: 'brain',
        path: '/user/brain',
        component: './user/brain',
      },
    ],
  },
  {
    path: '/',
    redirect: '/home',
  },
  {
    path: '*',
    layout: false,
    component: './404',
  },

  /**
   * ==================================================
   * 首页
   * ==================================================
   */
  {
    path: '/home',
    name: 'home',
    icon: 'HomeOutlined',
    component: './home',
  },
  {
    path: '/state',
    name: 'state',
    component: './state',
    layout: false,
  },
  /**
   * ============================================================================================================
   *
   *
   *
   *             广大入口
   *
   *             由 域名 直接访问
   *
   *
   * ============================================================================================================
   */
  /**
   * ==================================================
   * 线索汇聚
   * ==================================================
   */
  {
    name: 'aggregation',
    path: '/aggregation',
    icon: 'OrderedListOutlined',
    access: 'unIframShowCuesActive',
    routes: [
      /**
       * 其他线索
       */
      {
        name: 'county',
        path: '/aggregation/county',
        component: './aggregation/county',
        access: 'unIframShowAdmin',
      },
      /**
       * 群众爆料
       */
      {
        name: 'masses',
        path: '/aggregation/masses',
        component: './brain/aggregation/masses',
        access: 'unIframShowAdmin',
      },
    ],
  },
  /**
   * ==================================================
   *  选题策划
   * ==================================================
   */

  {
    name: 'cues.topic',
    path: '/cues/topic',
    icon: 'ShakeOutlined',
    component: './cues/topic',
    access: 'unIframShowCuesTopic',
  },
  /**
   * ==================================================
   *  报送线索
   * ==================================================
   */
  {
    name: 'cues.active',
    path: '/cues/active',
    icon: 'ShakeOutlined',
    component: './cues/active',
    access: 'unIframShowCuesActive',
  },

  /**
   * ==================================================
   *  报送线索
   * ==================================================
   */
  {
    name: 'cues.seek',
    path: '/cues/seek',
    icon: 'ShakeOutlined',
    component: './cues/seek',
    access: 'unIframShowCuesActive',
  },

  /**
   * ==================================================
   *  选题策划-数据分析
   * ==================================================
   */
  {
    name: 'cues.analysis.browser',
    path: '/brain/cues/analysis',
    component: './cues/analysis/browser',
    icon: 'LineChartOutlined',
    access: 'unIframShowCuesAnalysis',
  },

  //数据统计微信
  {
    name: 'cues.analysis.wechat',
    path: '/brain/cues/analysisWx',
    component: './cues/analysis/wechat',
    layout: false,
    access: 'unIframShowCuesAnalysis',
  },

  /**
   * ==================================================
   * 数据分析 - 用户
   * ==================================================
   */
  //浏览器端
  {
    name: 'analysis.user.browser',
    path: '/user/analysis',
    icon: 'AreaChartOutlined',
    component: './analysis/user/browser',
    access: 'unIframShowAdmin',
  },
  //微信端
  {
    name: 'analysis.user.wechat',
    path: '/user/analysisWx',
    component: './analysis/user/wechat',
    layout: false,
    access: 'unIframShowAdmin',
  },

  /**
   * ==================================================
   * 宣传指令
   * ==================================================
   */
  {
    name: 'instruct',
    path: '/instruct',
    icon: 'AuditOutlined',
    component: './instruct',
    access: 'unIframShowInstruct',
  },

  /**
   * ==================================================
   *  媒体采访需求
   * ==================================================
   */
  {
    name: 'interview',
    path: 'interview',
    component: './instruct/interview',
    icon: 'ShakeOutlined',
    access: 'unIframShowCuesInterview',
  },

  /**
   * ==================================================
   *  新闻发布
   * ==================================================
   */
  {
    name: 'pressconference',
    path: 'pressconference',
    component: './pressconference',
    icon: 'AudioOutlined',
    access: 'unIframShowPressconference',
  },

  /**
   * ==================================================
   * 监听监看 （传播跟踪监测）
   * ==================================================
   */
  {
    name: 'monitor',
    path: '/monitor',
    icon: 'FolderViewOutlined',
    access: 'unIframShowMonitor',
    routes: [
      {
        name: 'article',
        path: '/monitor/article',
        component: './monitor/article',
        // access: 'unIfram监听监看x图文审读',
      },
      {
        name: 'video',
        path: '/monitor/video',
        component: './monitor/video',
        // access: 'unIfram监听监看x视听监测',
      },
      {
        name: 'live',
        path: '/monitor/live',
        component: './monitor/live',
        // access: 'unIfram监听监看x直播管理',
      },
      {
        name: 'linkage',
        path: '/monitor/linkage',
        component: './monitor/linkage',
        // access: 'unIfram监听监看x联动处置',
      },
    ],
  },

  /**
   * ==================================================
   * 传播跟踪监测（合川）
   * ==================================================
   */
  {
    name: 'monitorhc',
    path: '/monitorhc',
    icon: 'FolderViewOutlined',
    access: 'unIframShowMonitorhc',
    routes: [
      {
        name: 'article',
        path: '/monitorhc/article',
        component: './monitorhc/article',
      },
      {
        name: 'video',
        path: '/monitorhc/video',
        component: './monitorhc/video',
      },
      {
        name: 'dispose',
        path: '/monitorhc/dispose',
        component: './monitorhc/dispose',
      },
    ],
  },

  /**
   * ==================================================
   * 文化报表             周
   * ==================================================
   */
  {
    path: '/assess/week/culture',
    name: 'assess.week.culture',
    icon: 'BookOutlined',
    component: './assess/week/culture',
    access: 'unIframShowAssess',
  },

  /**
   * ==================================================
   * 传播质效 - 重要稿件             周
   * ==================================================
   */
  {
    name: 'assess.week.emphasize',
    path: '/assess/week/emphasize',
    icon: 'OrderedListOutlined',
    component: './assess/week/emphasize',
    access: 'unIframShowEmphasize',
  },
  /**
  * ==================================================
  * 传播质效 - 重要稿件             月
  * ==================================================
  */
  {
    name: 'assess.month.emphasize',
    path: '/assess/month/emphasize',
    icon: 'OrderedListOutlined',
    component: './assess/month/emphasize',
    access: 'unIframShowEmphasize',
  },

  /**
   * ==================================================
   * 传播质效 - 三好作品 展览
   * ==================================================
   */
  {
    name: 'assess.week.threeGoodArticle',
    path: '/assess/week/threeGoodArticle',
    icon: 'OrderedListOutlined',
    component: './assess/week/threeGoodArticle',
    access: 'unIframShowEmphasize',
  },

  /**
   * ==================================================
   * 传播质效 - 汇总收集
   * ==================================================
   */
  {
    name: 'assess.week.collect',
    path: '/assess/week/collect',
    icon: 'FileZipOutlined',
    component: './assess/week/collect',
    access: 'unIframShowEmphasize',
  },

  /**
   * ==================================================
   * 传播质效
   * ==================================================
   */
  {
    name: 'assess.week.quality',
    path: '/assess/week/quality',
    component: './assess/week/quality',
    access: 'unIframShowEmphasize',
  },


  /**
   * ==================================================
   * 数据仓
   * ==================================================
   */
  {
    path: '/datahub',
    name: 'datahub',
    icon: 'BarChartOutlined',
    access: 'unIframShowDatahub',
    routes: [
      {
        name: 'record',
        path: '/datahub/record',
        component: './datahub/record',
        access: '数据仓x记录',
      },
      {
        name: 'keyword',
        path: '/datahub/keyword',
        component: './datahub/keyword',
        access: '数据仓x关键字',
      },
      {
        name: 'mark',
        path: '/datahub/mark',
        component: './datahub/mark',
        access: '数据仓x标注',
      },
      {
        name: 'label',
        path: '/datahub/label',
        component: './datahub/label',
        access: '数据仓x标签',
      },
      {
        name: 'area',
        path: '/datahub/area',
        component: './datahub/area',
        access: '数据仓x地域管理',
      },
      {
        name: 'source',
        path: '/datahub/source',
        component: './datahub/source',
        access: '数据仓x来源配置',
      },
      {
        name: 'synchrony',
        path: '/datahub/synchrony',
        component: './datahub/synchrony',
        access: '数据仓x同步配置',
      },
    ],
  },
  {
    path: '/tophub',
    name: 'tophub',
    icon: 'BarChartOutlined',
    access: 'unIframShowTophub',
    routes: [
      {
        name: 'page',
        path: '/tophub/page',
        component: './tophub',
      },
      {
        name: 'synchrony',
        path: '/tophub/synchrony',
        component: './tophub/synchrony',
        access: '热搜热榜x同步配置',
      },
    ],
  },

  /**
   * ==================================================
   * 系统管理
   * ==================================================
   */
  {
    path: '/admin',
    name: 'admin',
    icon: 'SettingOutlined',
    access: 'unIframShowAdmin',
    routes: [
      {
        name: 'account',
        path: '/admin/account',
        component: './admin/account',
        access: 'unIframShowAdmin',
      },
      {
        name: 'organization',
        path: '/admin/organization',
        component: './admin/organization',
        access: '系统管理x组织管理',
      },
      {
        name: 'role',
        path: '/admin/role',
        component: './admin/role',
        access: '系统管理x角色管理',
      },
      {
        name: 'permission',
        path: '/admin/permission',
        component: './admin/permission',
        access: '系统管理x权限管理',
      },
    ],
  },

  // /**
  //  * ==================================================
  //  * 每日要情
  //  * ==================================================
  //  */
  // {
  //   path: '/news',
  //   name: 'news',
  //   icon: 'SettingOutlined',
  //   access: 'unIframShowNews',
  //   routes: [
  //     {
  //       name: 'record',
  //       path: '/news/record',
  //       component: './admin/record',
  //       access: '每日要情x要情记录',
  //     },
  //     {
  //       name: 'manage',
  //       path: '/news/manage',
  //       component: './admin/manage',
  //       access: '每日要情x要情管理',
  //     },
  //   ],
  // },
  // /**
  //  * ==================================================
  //  * 个人中心
  //  * ==================================================
  //  */
  // {
  //   path: '/personal',
  //   name: 'personal',
  //   icon: 'QuestionCircleOutlined',
  //   component: './personal',
  //   access: 'unIframShowPersonal',
  // },
  // /**
  //  * ==================================================
  //  * 设置
  //  * ==================================================
  //  */
  // {
  //   path: '/setting',
  //   name: 'setting',
  //   icon: 'SettingOutlined',
  //   component: './setting',
  //   access: 'unIframShowSetting',
  // },

  // /**
  //  * ==================================================
  //  * 工具集
  //  * ==================================================
  //  */
  // {
  //   path: '/tool',
  //   name: 'tool',
  //   icon: 'QuestionCircleOutlined',
  //   component: './tool',
  //   access: 'unIframShowTool',
  // },
  // /**
  //  * ==================================================
  //  * 技术支持
  //  * ==================================================
  //  */
  // {
  //   path: '/feedback',
  //   name: 'feedback',
  //   icon: 'QuestionCircleOutlined',
  //   component: './feedback',
  //   access: 'unIframShowPersonal',
  // },

  /**
   * ============================================================================================================
   *
   *
   *
   *
   *                              传播大脑
   *
   *
   *
        广大提供得URL，

        在 iframe 标签中，src 默认填写 https://xtbs.ljsyy.net/user/brain?route=/xxx

        其中 /xxx  表示 要跳转的路由地址。

        当iframe加载后，可使用以下方法

          <Button
            type="primary"
            onClick={() => {
              goto('/instruct');
            }}
          >
            宣传指令
          </Button>

        const goto = (route: string) => {
            let send = document.getElementById('iframeContainer').contentWindow;
            send.postMessage({ route: route }, '*');
        };

        进行iframe容器内路由跳转，防止每次更新iframe的src导致重新加载
   *
   *
   *
   * ============================================================================================================
   */
  //线索征集
  {
    name: 'aggregation',
    path: '/brain/aggregation',
    component: './brain/aggregation',
    access: 'inIframeShowCuesActive',
    layout: false,
  },
  {
    name: 'aggregation',
    path: '/brain/aggregation/components/PageDetailsAggregation',
    component: './brain/aggregation/components/PageDetailsAggregation',
    access: 'inIframeShowCuesActive',
    layout: false,
  },
  /**
   * 选题计划
   */
  {
    name: 'cues.topic',
    path: '/brain/cues',
    component: './brain/cues',
    access: 'inIframeShowCuesActive',
    layout: false,
  },
  {
    name: 'cues.topic',
    path: '/brain/cues/components/PageDetailsTopicRender',
    component: './brain/cues/components/PageDetailsTopicRender',
    access: 'inIframeShowCuesActive',
    layout: false,
  },
  /**
   * ==================================================
   * 宣传指令
   * ==================================================
   */
  {
    name: 'instruct',
    path: '/brain/instruct',
    component: './brain/instruct',
    access: 'inIframeShowInstruct',
    layout: false,
  },
  {
    name: 'instruct',
    path: '/brain/instruct/components/PageDetailsRecord',
    component: './brain/instruct/components/PageDetailsRecord',
    access: 'inIframeShowInstruct',
    layout: false,
  },


  /**
   * ==================================================
   * 监看监听
   * ==================================================
   */
  {
    name: 'monitor.main',
    path: '/brain/monitor/main',
    component: './brain/monitor/main',
    access: 'inIframeShowMonitor',
    layout: false,
  },
  /**
   * ==================================================
   * 联动处置
   * ==================================================
   */
  {
    name: 'monitor.linkage',
    path: '/brain/monitor/linkage',
    component: './brain/monitor/linkage',
    access: 'inIframe监听监看x联动处置',
    layout: false,
  },

  /**
   * ==================================================
   * 传播跟踪监测（合川）
   * ==================================================
   */
  {
    name: 'monitorhc',
    path: '/brain/monitorhc',
    component: './brain/monitorhc',
    access: 'inIframeShowMonitorhc',
    layout: false,
  },
  /**
   * ==================================================
   * 文化报表
   * ==================================================
   */
  {
    name: 'assess',
    path: '/brain/assess',
    component: './brain/assess',
    layout: false,
  },

  /**
   * ==================================================
   * 采访任务
   * ==================================================
   */
  {
    name: 'interview',
    path: '/brain/interview',
    component: './brain/interview',
    layout: false,
  },
];
